.class public final Ldgb/e0;
.super Ljava/lang/Object;
.source "SourceFile"


# static fields
.field private static f:Ldgb/e0;


# instance fields
.field private a:Landroid/content/Context;

.field private b:Ljava/lang/String;

.field private c:Z

.field private d:Ljava/lang/Object;

.field private final e:Ljava/lang/Runnable;


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method private constructor <init>(Landroid/content/Context;)V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const-string v0, ""

    .line 2
    iput-object v0, p0, Ldgb/e0;->b:Ljava/lang/String;

    const/4 v0, 0x0

    .line 3
    iput-boolean v0, p0, Ldgb/e0;->c:Z

    .line 4
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Ldgb/e0;->d:Ljava/lang/Object;

    .line 5
    new-instance v0, Ldgb/e0$a;

    invoke-direct {v0, p0}, Ldgb/e0$a;-><init>(Ldgb/e0;)V

    iput-object v0, p0, Ldgb/e0;->e:Ljava/lang/Runnable;

    .line 6
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object p1

    iput-object p1, p0, Ldgb/e0;->a:Landroid/content/Context;

    .line 7
    invoke-direct {p0}, Ldgb/e0;->d()V

    return-void
.end method

.method public static a(Landroid/content/Context;)Ldgb/e0;
    .locals 2

    .line 4
    const-class v0, Ldgb/e0;

    monitor-enter v0

    .line 5
    :try_start_0
    sget-object v1, Ldgb/e0;->f:Ldgb/e0;

    if-nez v1, :cond_0

    .line 6
    new-instance v1, Ldgb/e0;

    invoke-direct {v1, p0}, Ldgb/e0;-><init>(Landroid/content/Context;)V

    sput-object v1, Ldgb/e0;->f:Ldgb/e0;

    .line 7
    :cond_0
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 8
    sget-object p0, Ldgb/e0;->f:Ldgb/e0;

    return-object p0

    :catchall_0
    move-exception p0

    .line 9
    :try_start_1
    monitor-exit v0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p0
.end method

.method static synthetic a(Ldgb/e0;)Ljava/lang/String;
    .locals 0

    .line 1
    iget-object p0, p0, Ldgb/e0;->b:Ljava/lang/String;

    return-object p0
.end method

.method static synthetic a(Ldgb/e0;Ljava/lang/String;)Z
    .locals 0

    .line 2
    invoke-direct {p0, p1}, Ldgb/e0;->a(Ljava/lang/String;)Z

    move-result p0

    return p0
.end method

.method static synthetic a(Ldgb/e0;Z)Z
    .locals 0

    .line 3
    iput-boolean p1, p0, Ldgb/e0;->c:Z

    return p1
.end method

.method private a(Ljava/lang/String;)Z
    .locals 8

    const-string v0, "token"

    .line 11
    sget-boolean v1, Ldgb/z;->b:Z

    const-string v2, "stat.TokenUtils"

    if-eqz v1, :cond_0

    const-string v1, "Enter reportToken()"

    .line 12
    invoke-static {v2, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 13
    :cond_0
    iget-object v1, p0, Ldgb/e0;->a:Landroid/content/Context;

    invoke-static {v1}, Ldgb/z;->a(Landroid/content/Context;)Z

    move-result v1

    const/4 v3, 0x0

    if-nez v1, :cond_1

    return v3

    .line 14
    :cond_1
    :try_start_0
    iget-object v1, p0, Ldgb/e0;->a:Landroid/content/Context;

    invoke-static {v0, v1}, Ldgb/z;->a(Ljava/lang/String;Landroid/content/Context;)Ljava/lang/String;

    move-result-object v1

    .line 15
    new-instance v4, Lorg/json/JSONObject;

    invoke-direct {v4}, Lorg/json/JSONObject;-><init>()V

    .line 16
    iget-object v5, p0, Ldgb/e0;->a:Landroid/content/Context;

    invoke-static {v5}, Ldgb/d0;->a(Landroid/content/Context;)Ljava/util/Map;

    move-result-object v5

    .line 17
    invoke-interface {v5}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v5

    invoke-interface {v5}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v5

    .line 18
    :goto_0
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v6

    if-eqz v6, :cond_2

    .line 19
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/util/Map$Entry;

    .line 20
    invoke-interface {v6}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Ljava/lang/String;

    invoke-interface {v6}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v6

    invoke-virtual {v4, v7, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    goto :goto_0

    .line 21
    :cond_2
    new-instance v5, Ljava/util/HashMap;

    invoke-direct {v5}, Ljava/util/HashMap;-><init>()V

    .line 22
    invoke-virtual {v5, v0, p1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 23
    iget-object p1, p0, Ldgb/e0;->a:Landroid/content/Context;

    invoke-static {p1}, Ldgb/l;->a(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p1

    .line 24
    invoke-static {}, Ldgb/l;->a()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0, p1}, Ldgb/j;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string v6, "pu"

    .line 25
    invoke-virtual {v5, v6, p1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    const-string p1, "ci"

    .line 26
    invoke-virtual {v5, p1, v0}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    const-string p1, "hw"

    .line 27
    invoke-virtual {v4}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {}, Ldgb/l;->b()[B

    move-result-object v4

    invoke-static {v0, v4}, Ldgb/j;->a(Ljava/lang/String;[B)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v5, p1, v0}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 28
    iget-object p1, p0, Ldgb/e0;->a:Landroid/content/Context;

    const-string v0, "UTF-8"

    .line 29
    invoke-static {v5, v0}, Ldgb/m0;->a(Ljava/util/HashMap;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string v4, "CoreServiceToken"

    const v5, 0x11003

    .line 30
    invoke-static {p1, v0, v1, v4, v5}, Ldgb/c0;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Z

    move-result p1
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    return p1

    :catch_0
    move-exception p1

    .line 31
    sget-boolean v0, Ldgb/z;->d:Z

    if-eqz v0, :cond_3

    const-string v0, "Can not report the token."

    .line 32
    invoke-static {v2, v0, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    :cond_3
    return v3
.end method

.method static synthetic b(Ldgb/e0;)Z
    .locals 0

    .line 1
    iget-boolean p0, p0, Ldgb/e0;->c:Z

    return p0
.end method

.method static synthetic c(Ldgb/e0;)V
    .locals 0

    .line 1
    invoke-direct {p0}, Ldgb/e0;->e()V

    return-void
.end method

.method private d()V
    .locals 6

    .line 1
    iget-object v0, p0, Ldgb/e0;->a:Landroid/content/Context;

    const/4 v1, 0x0

    const-string v2, "utils"

    invoke-virtual {v0, v2, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    const-string v2, "st"

    .line 2
    invoke-interface {v0, v2, v1}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v2

    iput-boolean v2, p0, Ldgb/e0;->c:Z

    const-wide/16 v2, -0x1

    const-string v4, "rt"

    .line 3
    invoke-interface {v0, v4, v2, v3}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v4

    cmp-long v0, v4, v2

    if-eqz v0, :cond_0

    .line 4
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    sub-long/2addr v2, v4

    const-wide/32 v4, 0x48190800

    cmp-long v0, v2, v4

    if-lez v0, :cond_1

    .line 5
    :cond_0
    iput-boolean v1, p0, Ldgb/e0;->c:Z

    .line 6
    :cond_1
    iget-object v0, p0, Ldgb/e0;->a:Landroid/content/Context;

    invoke-static {v0}, Ldgb/i4;->a(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Ldgb/e0;->b:Ljava/lang/String;

    .line 7
    sget-boolean v0, Ldgb/z;->c:Z

    if-eqz v0, :cond_2

    .line 8
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Loaded token: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v1, p0, Ldgb/e0;->b:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, ", status: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-boolean v1, p0, Ldgb/e0;->c:Z

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "stat.TokenUtils"

    invoke-static {v1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    :cond_2
    return-void
.end method

.method private e()V
    .locals 4

    .line 1
    iget-object v0, p0, Ldgb/e0;->a:Landroid/content/Context;

    const-string v1, "utils"

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    .line 2
    invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 3
    iget-boolean v1, p0, Ldgb/e0;->c:Z

    const-string v2, "st"

    invoke-interface {v0, v2, v1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    .line 4
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v1

    const-string v3, "rt"

    invoke-interface {v0, v3, v1, v2}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    .line 5
    invoke-static {v0}, Ldgb/z;->a(Landroid/content/SharedPreferences$Editor;)V

    return-void
.end method


# virtual methods
.method public a()Ljava/lang/String;
    .locals 1

    .line 10
    iget-object v0, p0, Ldgb/e0;->b:Ljava/lang/String;

    return-object v0
.end method

.method public b()Ljava/lang/String;
    .locals 1

    .line 2
    iget-object v0, p0, Ldgb/e0;->b:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    if-eqz v0, :cond_0

    iget-boolean v0, p0, Ldgb/e0;->c:Z

    if-nez v0, :cond_0

    .line 3
    iget-object v0, p0, Ldgb/e0;->e:Ljava/lang/Runnable;

    invoke-static {v0}, Ldgb/b0;->a(Ljava/lang/Runnable;)Z

    .line 4
    :cond_0
    iget-object v0, p0, Ldgb/e0;->b:Ljava/lang/String;

    return-object v0
.end method

.method public c()V
    .locals 2

    .line 2
    iget-object v0, p0, Ldgb/e0;->d:Ljava/lang/Object;

    monitor-enter v0

    const/4 v1, 0x0

    .line 3
    :try_start_0
    iput-boolean v1, p0, Ldgb/e0;->c:Z

    .line 4
    invoke-direct {p0}, Ldgb/e0;->e()V

    .line 5
    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method
